<?php

declare(strict_types=1);

namespace app\chat\controller\admin;

use think\Request;
use think\Response;
use sheep\model\Config as SheepConfig;
use sheep\controller\Backend;

class Config extends Backend
{

    /**
     * 客服配置
     *
     * @return Response
     */
    public function basic(Request $request): Response
    {
        if ('GET' === $request->method()) {

            $configs = SheepConfig::getConfigs('chat.basic', false);
        } elseif ('PUT' === $request->method()) {

            $configs = SheepConfig::setConfigs('chat.basic', $request->param());

        }
        return success('操作成功', $configs);
    }

    /**
     * 系统配置
     */
    public function system(Request $request): Response
    {
        if ('GET' === $request->method()) {

            $configs = SheepConfig::getConfigs('chat.system', false);
        } elseif ('PUT' === $request->method()) {

            $configs = SheepConfig::setConfigs('chat.system', $request->param());

        }
        return success('操作成功', $configs);
    }

    /**
     * 客服应用配置
     */
    public function application(Request $request): Response
    {
        if ('GET' === $request->method()) {
            $configs = SheepConfig::getConfigs('chat.application', false);
        } elseif ('PUT' === $request->method()) {

            $configs = SheepConfig::setConfigs('chat.application', $request->param());

        }
        return success('操作成功', $configs);
    }
}
